#include<iostream>
#include<vector>
#include<string>
using namespace std;
class Solution {
public:
    string multiply(string num1, string num2) {
        vector<int>v1,v2;
        for(int i=num1.size()-1;i>=0;i--)v1.push_back(num1[i]-'0');
        for(int i=num2.size()-1;i>=0;i--)v2.push_back(num2[i]-'0');
        vector<int>ans(num1.size()+num2.size());
        for(int i=0;i<num1.size();i++)
        {
            for(int j=0;j<num2.size();j++)
            {
                ans[i+j]+=v1[i]*v2[j];
            }
        }
        int t=0;
        for(int i=0;i<ans.size();i++){
            t+=ans[i];
            ans[i]=t%10;
            t/=10;
        }
        int k=ans.size()-1;
        while(k>0&&ans[k]==0)k--;
        string res;
        while(k>=0)res+=ans[k--]+'0';
        return res;
    }
};